﻿Jxstar.currentPage = function() {
	var config = {param:{},initpage:function(page, define){},eventcfg:{}};

	var auditData = Jxstar.findComboData('audit');
	var authtypeData = Jxstar.findComboData('authtype');
	var moneytypeData = Jxstar.findComboData('moneytype');

	var cols = [
	{col:{header:'记录状态', width:82, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: auditData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: auditData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < auditData.length; i++) {
				if (auditData[i][0] == value)
					return auditData[i][1];
			}
		}}, field:{name:'pur_say_record__auditing',type:'string'}},
	{col:{header:'采购单号', width:100, sortable:true}, field:{name:'pur_say_record__apply_code',type:'string'}},
	{col:{header:'项目编号', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__project_code',type:'string'}},
	{col:{header:'项目名称', width:245, sortable:true}, field:{name:'pur_say_record__project_name',type:'string'}},
	{col:{header:'授权形式', width:100, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: authtypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: authtypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < authtypeData.length; i++) {
				if (authtypeData[i][0] == value)
					return authtypeData[i][1];
			}
		}}, field:{name:'pur_say_record__auth_type',type:'string'}},
	{col:{header:'预算金额(万元)', width:125, sortable:true, renderer:JxUtil.formatNumber(6)}, field:{name:'pur_say_record__project_money',type:'float'}},
	{col:{header:'项目类别', width:100, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: moneytypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: moneytypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < moneytypeData.length; i++) {
				if (moneytypeData[i][0] == value)
					return moneytypeData[i][1];
			}
		}}, field:{name:'pur_say_record__money_type',type:'string'}},
	{col:{header:'实施单位', width:100, sortable:true}, field:{name:'pur_say_record__dept_name',type:'string'}},
	{col:{header:'主管部门', width:100, sortable:true}, field:{name:'pur_say_record__done_deptname',type:'string'}},
	{col:{header:'项目批复文号', width:100, sortable:true}, field:{name:'pur_say_record__check_fileno',type:'string'}},
	{col:{header:'项目负责人', width:100, sortable:true}, field:{name:'pur_say_record__project_user',type:'string'}},
	{col:{header:'谈判时间', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'pur_say_record__say_time',type:'date'}},
	{col:{header:'谈判地点', width:100, sortable:true}, field:{name:'pur_say_record__say_address',type:'string'}},
	{col:{header:'谈判情况记录', width:232, sortable:true, hidden:true}, field:{name:'pur_say_record__state_record',type:'string'}},
	{col:{header:'谈判结论', width:217, sortable:true, hidden:true}, field:{name:'pur_say_record__say_result',type:'string'}},
	{col:{header:'公司谈判小组成员', width:206, sortable:true, hidden:true}, field:{name:'pur_say_record__join_person',type:'string'}},
	{col:{header:'备注', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__memo',type:'string'}},
	{col:{header:'主键', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__record_id',type:'string'}},
	{col:{header:'采购单ID', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__apply_id',type:'string'}},
	{col:{header:'项目ID', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__project_id',type:'string'}},
	{col:{header:'实施单位ID', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__dept_id',type:'string'}},
	{col:{header:'项目批复名称', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__check_name',type:'string'}},
	{col:{header:'选中供应商', width:100, sortable:true}, field:{name:'pur_say_record__provider_name',type:'string'}},
	{col:{header:'登记人', width:100, sortable:true}, field:{name:'pur_say_record__result_user',type:'string'}},
	{col:{header:'第一家供应商谈判情况记录', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__first_sayred',type:'string'}},
	{col:{header:'第二家供应商谈判情况记录', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__second_sayred',type:'string'}},
	{col:{header:'第三家供应商谈判情况记录', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__third_sayred',type:'string'}},
	{col:{header:'第四家供应商谈判情况记录', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__fourth_sayred',type:'string'}},
	{col:{header:'监督小组', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__sup_group',type:'string'}},
	{col:{header:'项目负责人ID', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__project_userid',type:'string'}},
	{col:{header:'选中供应商ID', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__provider_id',type:'string'}},
	{col:{header:'主管部门ID', width:100, sortable:true, hidden:true}, field:{name:'pur_say_record__done_deptid',type:'string'}},
	{col:{header:'中标金额(万元)', width:100, sortable:true, hidden:true, renderer:JxUtil.formatNumber(6)}, field:{name:'pur_say_record__bid_money',type:'float'}}
	];
	
	config.param = {
		cols: cols,
		sorts: null,
		hasQuery: '1',
		isedit: '0',
		isshow: '1',
		funid: 'pur_say_record'
	};
	
	config.initpage = function(gridNode) {		var grid = gridNode.page;		var event = gridNode.event;		//提交前检查必填项是否都有值		event.on('beforeaudit', function(ge) {			var records = ge.grid.getSelectionModel().getSelections();			if (!JxUtil.selectone(records)) return false;					var say_time = records[0].get('pur_say_record__say_time');			var result_user = records[0].get('pur_say_record__result_user');			var provider_name = records[0].get('pur_say_record__provider_name');			var join_person = records[0].get('pur_say_record__join_person');			var say_result = records[0].get('pur_say_record__say_result');			if (say_time == null || say_time.length == 0) {				JxHint.alert('该项信息还没填写完整，不能提交！');					return false;			}			if (result_user == null || result_user.length == 0) {				JxHint.alert('该项信息还没填写完整，不能提交！');					return false;			}			if (provider_name == null || provider_name.length == 0) {				JxHint.alert('该项信息还没填写完整，不能提交！');					return false;			}			if (join_person == null || join_person.length == 0) {				JxHint.alert('该项信息还没填写完整，不能提交！');					return false;			}			if (say_result == null || say_result.length == 0) {				JxHint.alert('该项信息还没填写完整，不能提交！');					return false;			}		});			}
		
	return new Jxstar.GridNode(config);
}